package com.itcast.manager3.C_service;

import com.itcast.manager3.D_dao.TecherDao;
import com.itcast.manager3.tomian.TecherTomain;

import java.util.ArrayList;

public class TecherService {
    TecherDao td = new TecherDao();
    public void addTecher(TecherTomain th) {
        td.addTecher(th);
    }

    public boolean isExistss(String id) {
        ArrayList<TecherTomain> list = td.getAllTecher();
        for (int i = 0; i < list.size(); i++) {
            TecherTomain th = list.get(i);
            if (th.getId().equals(id)) {
                return true;
            }
        }
        return false;
    }

    public ArrayList<TecherTomain> getAllTecher() {
       ArrayList<TecherTomain>list =  td.getAllTecher();
       return list;
    }

    public void deleteTecher(String id) {
        td.deleteTcher(id);
    }

    public void updeteTcher(TecherTomain tt) {
        td.updateTcher(tt);
    }
}
